import {
  exportUrl,
  getOrderTypeList,
  getOrderStatusList,
} from "@/api/materialRequisition/mesMaterialRequisition";
// 列表头按钮配置
export const operateList = [
  // {
  //   name: $i18n.t("common.export"),
  //   type: "primary",
  //   icon: "el-icon-download",
  //   handleName: "export", //点击时返回的标识
  //   url: exportUrl,
  //   //auth: "auth:operlog:export", //权限字段
  // },
];

var choiceDate = null;
// 行末按钮配置
export const rowConfig = [
  {
    name: $i18n.t("common.view"),
    type: "primary",
    class: "row-btn-primary",
    handleName: "show", //点击时返回的标识
  },
];
// 搜索条件配置
export const searchConfig = {
  inline: true,
  formDesc: {
    prodName: {
      type: "input",
      label: $i18n.t("requirementAnalysis.prodName"),
      layout: 5,
    },
    seriesName: {
      type: "input",
      label: $i18n.t("requirementAnalysis.seriesName"),
      layout: 5,
    },
    planTime: {
      type: "daterange",
      label: $i18n.t("requirementAnalysis.planTime"),
      layout: 8,
      attrs: {
        valueFormat: "yyyy-MM-dd",
        searchArrKey: ["searchDateMin", "searchDateMax"],
        clearable: false,
        pickerOptions: {
          onPick: ({ maxDate, minDate }) => {
            // 把选择的第一个日期赋值给一个变量。
            choiceDate = minDate.getTime();
            // 如何你选择了两个日期了，就把那个变量置空
            if (maxDate) choiceDate = "";
          },
          disabledDate: (time) => {
            // 如何选择了一个日期
            if (choiceDate) {
              // 7天的时间戳
              const one = 30 * 24 * 3600 * 1000;
              // 当前日期 - one = 7天之前
              const minTime = choiceDate - one;
              // 当前日期 + one = 7天之后
              const maxTime = choiceDate + one;
              return (
                time.getTime() < minTime || time.getTime() > maxTime
                // 限制不能选择今天及以后
                // time.getTime() > Date.now()
              );
            } else {
              // 如果没有选择日期，就要限制不能选择今天及以后
              // return time.getTime() > Date.now();
            }
          },
        },
      },
    },
    prodCode: {
      type: "input",
      label: $i18n.t("requirementAnalysis.prodCode"),
    },
    seriesCode: {
      type: "input",
      label: $i18n.t("requirementAnalysis.seriesCode"),
    },
  },
};
